<?php
/**
 * Created by PhpStorm.
 * User: wangkxin@foxmail.com
 * Date: 2020/9/15
 * Time: 11:31
 */

namespace app\api\controller;
use think\Controller;
use app\bis\model\City as CityModel;

class City extends Controller
{
    private $obj;
    public function _initialize()
    {
       $this->obj = new CityModel();
    }

    public function getCitysByParentId()
    {
        $id = input('post.id');
        if(!$id){
            $this->error('ID不合法');
        }
        //通过id获取二级城市
        $citys = $this->obj->getNormalCityByParentId($id);
        if(!$citys){
            return show(0,'error');
        }
        return show(1, 'success',$citys);
    }


}